<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <style>
        div {
            border: 1px solid red;
            margin: 10px;
        }
    </style>
</head>
<body>
<div id="hard1">
    <div class="x">
        <div class="y">
            <div class="y">
                <div class="z">
                    x y y z<br>
                    x>y z
                </div>
            </div>
        </div>
    </div>
</div>

<div id="hard2">
    <div class="x">
        <div class="y">
            <div class="q">
                <div class="n">
                    <div class="n">
                        <div class="n">
                            <div class="n">
                                <div class="n">
                                    <div class="n">
                                        <div class="n">
                                            <div class="y">
                                                <div class="q">
                                                    <div class="y">
                                                        <div class="z">
                                                            x y q n n y q y z<br>
                                                            x>y>q y>z
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard3">
    <div class="x">
        <div class="n">
            <div class="y">
                <div class="y">
                    <div class="z">
                        x n y y z<br>
                        x>y z
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard4">
    <div class="x">
        <div class="y">
            <div class="n">
                <div class="x">
                    <div class="y">
                        <div class="n">
                            <div class="y">
                                <div class="y">
                                    <div class="z">
                                        x y n x y n y y z<br>
                                        x>y x>y z
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard5">
    <div class="x">
        <div class="n">
            <div class="y">
                <div class="y">
                    <div class="z">
                        x n y y z<br>
                        y>z
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard6">
    <div class="x">
        <div class="n">
            <div class="y">
                <div class="y">
                    <div class="z">
                        x n y y z<br>
                        y z
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard7">
    <div class="x">
        <div class="n">
            <div class="y">
                <div class="n">
                    <div class="x">
                        <div class="y">
                            <div class="n">
                                <div class="y">
                                    <div class="y">
                                        <div class="z">
                                            x n y n x y n y y z<br>
                                            x y x>y z
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="hard8">
    <div class="x">
        <div class="n">
            <div class="y">
                <div class="n">
                    <div class="x">
                        <div class="y">
                            <div class="n">
                                <div class="y">
                                    <div class="y">
                                        <div class="z">
                                            x n y n x y n y y z<br>
                                            x>y x>y z
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/kissy/build/seed.js"></script>
<script src="/kissy/src/package.js"></script>
<script src="/kissy/tools/third-party/sizzle.js"></script>
<script>
    KISSY.use('dom/selector', function (S, engine) {
        var str = [
            '.x>.y div.z',
            '.x>.y>.q .y>div.z',
            '.x>.y div.z',
            '.x>.y .x>.y div.z',
            '.y>div.z',
            '.y div.z',
            '.x .y .x>.y div.z',
            '.x>.y .x>.y div.z'
        ];
        S.each(str, function (s, index) {
            index++;
            S.log(index + ': ' + s);
            var start = S.now();

            var els = engine.select(s, document.getElementById('hard' + index));
            S.log('KISSY: ' + (S.now() - start));
            S.log(els);
            start = S.now();
            var els2 = Sizzle(s, document.getElementById('hard' + index));
            S.log('Sizzle: ' + (S.now() - start));
            S.log(els2);
            if (!S.equals(els, els2)) {
                S.log('error !!!!!!!!!!!!!!!!!!')
            }
        });

    });
</script>
</body>
</html>